From ffbce6fed77e74e6e18d40fa9dbda3ae5d5eaa8f Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Thu, 30 Jan 2025 23:33:46 +0000 Subject: [PATCH] luci-mod-status: add `oneshot` handling This allows each include to perform an action a single time but doesn't run it on each poll (instead running it once per page load). The function receives all data loaded via the `load` function. Signed-off-by: Paul Spooren --- .../htdocs/luci-static/resources/view/status/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js index da08ec12c2..911c187584 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js @@ -40,6 +40,11 @@ function startPolling(includes, containers) { else if (includes[i].content != null) content = includes[i].content; + if (typeof (includes[i].oneshot) == 'function') { + includes[i].oneshot(results ? results[i] : null); + includes[i].oneshot = null; + } + if (content != null) { containers[i].parentNode.style.display = ''; containers[i].parentNode.classList.add('fade-in'); -- 2.30.2